<?php

/**
 * InvoiceRow form base class.
 *
 * @method InvoiceRow getObject() Returns the current form's model object
 *
 * @package    dashboard
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseInvoiceRowForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'row_id'          => new sfWidgetFormInputHidden(),
      'row_dateadded'   => new sfWidgetFormDateTime(),
      'row_dateordered' => new sfWidgetFormDateTime(),
      'row_servicename' => new sfWidgetFormInputText(),
      'row_benchmark'   => new sfWidgetFormInputText(),
      'row_newprice'    => new sfWidgetFormInputText(),
      'row_hauler_cost' => new sfWidgetFormInputText(),
      'row_haul_cost'   => new sfWidgetFormInputText(),
      'row_perton'      => new sfWidgetFormInputText(),
      'row_tons'        => new sfWidgetFormInputText(),
      'row_fuel_fee'    => new sfWidgetFormInputText(),
      'row_latefee'     => new sfWidgetFormInputText(),
      'row_adminfee'    => new sfWidgetFormInputText(),
      'row_franchise'   => new sfWidgetFormInputText(),
      'row_item_unit'   => new sfWidgetFormInputText(),
      'row_item_price'  => new sfWidgetFormInputText(),
      'row_item_qty'    => new sfWidgetFormInputText(),
      'serv_group_id'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Service'), 'add_empty' => false)),
      'invoice_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Invoice'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'row_id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('row_id')), 'empty_value' => $this->getObject()->get('row_id'), 'required' => false)),
      'row_dateadded'   => new sfValidatorDateTime(),
      'row_dateordered' => new sfValidatorDateTime(),
      'row_servicename' => new sfValidatorString(array('max_length' => 100)),
      'row_benchmark'   => new sfValidatorNumber(),
      'row_newprice'    => new sfValidatorNumber(),
      'row_hauler_cost' => new sfValidatorNumber(),
      'row_haul_cost'   => new sfValidatorNumber(array('required' => false)),
      'row_perton'      => new sfValidatorNumber(array('required' => false)),
      'row_tons'        => new sfValidatorNumber(array('required' => false)),
      'row_fuel_fee'    => new sfValidatorNumber(),
      'row_latefee'     => new sfValidatorNumber(),
      'row_adminfee'    => new sfValidatorNumber(),
      'row_franchise'   => new sfValidatorNumber(),
      'row_item_unit'   => new sfValidatorString(array('max_length' => 20)),
      'row_item_price'  => new sfValidatorNumber(),
      'row_item_qty'    => new sfValidatorInteger(),
      'serv_group_id'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Service'))),
      'invoice_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Invoice'))),
    ));

    $this->widgetSchema->setNameFormat('invoice_row[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'InvoiceRow';
  }

}
